//
//  HMNavBaseViewController.m
//  localLife
//
//  Created by Limonwei on 15/11/23.
//  Copyright © 2015年 heima. All rights reserved.
//

#import "HMNavBaseViewController.h"
#define KNavButtonWidth 44

@interface HMNavBaseViewController ()

@end

@implementation HMNavBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    _nav = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kUIScreenWidth, KUINavHeight)];
    
    _nav.backgroundColor = [UIColor redColor];
    
    [self.view addSubview:_nav];
    
    
    
    
    _leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    _leftButton = [[UIButton alloc]initWithFrame:CGRectMake(0, KUIStatusBarHeight, KNavButtonWidth, KNavButtonWidth)];
    
    [_leftButton setBackgroundImage:[UIImage imageNamed:@"nav_back"] forState:UIControlStateNormal];
    
    [_leftButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
    
    [_nav addSubview:_leftButton];
    
    
    
    
    
    _rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    
    if (/* DISABLES CODE */ (YES)) {
        _rightButton = [[UIButton alloc]initWithFrame:CGRectMake(kUIScreenWidth-KNavButtonWidth, KUIStatusBarHeight, KNavButtonWidth, KNavButtonWidth)];
        [_rightButton setBackgroundImage:[UIImage imageNamed:@"nav_user"] forState:UIControlStateNormal];
    }else{
        [_rightButton setTitle:@"登陆/注册" forState:UIControlStateNormal];
        
        [_rightButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        
        _rightButton = [[UIButton alloc]initWithFrame:CGRectMake(kUIScreenWidth-2*KNavButtonWidth, KUIStatusBarHeight, KNavButtonWidth*2, KNavButtonWidth)];
        
    }
    [_rightButton addTarget:self action:@selector(login) forControlEvents:UIControlEventTouchUpInside];
    
    [_nav addSubview:_rightButton];
    
    
    
    _titltLabel = [[UILabel alloc]initWithFrame:CGRectMake(KNavButtonWidth, KUIStatusBarHeight, kUIScreenWidth-2*KNavButtonWidth, KNavButtonWidth)];
    
    _titltLabel.text = @"标题";
    
    _titltLabel.textAlignment = NSTextAlignmentCenter;
    
    _titltLabel.font = [UIFont systemFontOfSize:19];
    
    [_nav addSubview:_titltLabel];
    
}

-(void)back{
    
    
}

-(void)login{
    
    
}


-(void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:animated];
    
    self.navigationController.navigationBar.hidden = YES;
}

@end


































